<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\admin\model;

class OssConfig extends \app\BaseModel
{
    protected $name = "shequshop_school_oos_config";
    public function createConfig($data)
    {
        $data["create_time"] = time();
        $data["open_oss"] = 0;
        $result = $this->save($data);
        if(empty($result)) {
            return false;
        }
        return true;
    }
    public function updateConfig($filter, $data)
    {
        $filter["deleted"] = 0;
        $data["update_time"] = time();
        $result = $this->where($filter)->update($data);
        if(empty($result)) {
            return false;
        }
        return true;
    }
    public function listConfig($filter)
    {
        $filter["deleted"] = 0;
        $result = $this->where($filter)->select();
        if(!empty($result)) {
            $result->toArray();
        }
        return $result;
    }
    public function listConfigCount($filter)
    {
        $filter["deleted"] = 0;
        $result = $this->where($filter)->count();
        return $result;
    }
    public function getConfig($filter)
    {
        $filter["deleted"] = 0;
        $result = $this->where($filter)->find();
        if(!empty($result)) {
            $result = $result->toArray();
        }
        return $result;
    }
    public function delConfig($filter)
    {
        $filter["deleted"] = 0;
        return $this->updateConfig($filter, ["deleted" => 0, "delete_time" => time()]);
    }
    public function destoryConfig($filter)
    {
        return $this->where($filter)->delete();
    }
}

?>